#ifndef _OGL_SURFACE_H_
#define _OGL_SURFACE_H_

#include "graphics/surface.h"


class OglSurface : public Surface
{
public:
	/// static constructor
	static res::ResourceFile*	CreateImage();
	/// register the valid extensions to our constructors
	static void				RegisterFormats();

	/// set the surface as a texture to the stage
	virtual bool			SetTextureStage(unsigned int _TexStage);

	virtual AlphaMask*		GenerateMask();
	virtual COLOR*			GetPixels();		// gets the top-level surface
	virtual float*			GetColors();		// gets the top-level surface as quintuples
	virtual void			GetTexMemory(unsigned int &A,unsigned int &B,unsigned int &C,unsigned int &D){}
	// accessors
  
	virtual void			InitTexture();
protected:
	// private
	OglSurface();
	virtual ~OglSurface();
	virtual void			ReleaseResource();

	
	int						PngLoad(vfs::LoadedBlock& LoadedData , unsigned char** image_data_ptr 
									, int &Width, int &Height,int &Format);
	int						JpegLoad(vfs::LoadedBlock& LoadedData ,unsigned char** image_data_ptr 
									,  int &Width, int &Height,int &Channel);
	

	inline int				NextPowerof2(int Num);
	bool					IsPowerOfTwo(int Num);
	
	unsigned int			m_Texture;
	int						m_ColorChannel;
};

#endif // _ogl_SURFACE_H_